<template>
  <div
    class="vaw-side-bar-wrapper"
    :class="[!getLayoutStore_isCollapse ? 'open-status' : 'close-status']"
  >
    <transition name="logo">
      <ly-logo v-if="showLogo" />
    </transition>
    <ly-scroller-menu>
      <template v-for="item of routes">
        <ly-side-bar-item
          :key="item.path"
          :full-path="item.path"
          :item="item"
        />
      </template>
    </ly-scroller-menu>

    <div class="mobile-shadow"></div>
  </div>
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import { LayoutStoreModule } from "@/store/modules/LayoutStore";

@Component({
  name: "LySidebar",
  components: {},
})
export default class LySidebar extends Vue {
  //#region vue prop =================================
  @Prop({
    type: Boolean,
    default: true,
  })
  showLogo: boolean;
  //#endregion

  //#region vue data =================================

  //#endregion
  //#region computed getter =================================

  //#endregion
  //#region vue life =================================
  created() {
    console.log("LySidebar " + "created");
  }

  mounted() {
    console.log("LySidebar " + "mounted");
  }

  beforeDestroy() {
    console.log("LySidebar " + "beforeDestroy");
  }

  //#endregion
  //#region comp getter =================================
  get routes() {
    return (
      (LayoutStoreModule.permissionRoutes &&
        LayoutStoreModule.permissionRoutes.filter((it) => !!it.name)) ||
      []
    );
  }
  get getLayoutStore_isCollapse() {
    return LayoutStoreModule.isCollapse;
  }
  //#endregion
  //#region server data =================================

  //#endregion
  //#region components Func =================================

  //#endregion
  //#region Public Func =================================

  //#endregion
  //#region view layout =================================

  //#endregion
}
</script>
<style scoped lang="scss">
@import "src/assets/styles/variables.scss";
.open-status {
  width: $menuWidth;
  box-shadow: 2px 5px 5px rgb(202, 202, 202, 0.8);
  transition: all $transitionTime;
}
.close-status {
  width: $minMenuWidth;
  box-shadow: none;
  transition: all $transitionTime;
}
.vaw-side-bar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  overflow-x: hidden;
  height: 100%;
  box-sizing: border-box;
  z-index: 999;
  .vaw-menu-wrapper {
    overflow-x: hidden;
    color: white;
  }
  .scrollbar {
    height: calc(100% - #{$logoHeight}) !important;
  }
}
.is-mobile {
  .open-status {
    width: $menuWidth;
    transform: translateX(0);
    transition: transform $transitionTime;
  }
  .close-status {
    width: $menuWidth;
    transform: translateX(-$menuWidth);
    transition: transform $transitionTime;
    box-shadow: none;
  }
}
</style>
<style lang="scss">
@import "src/assets/styles/variables.scss";
.scrollbar-wrap-class {
  overflow-x: hidden !important;
}
.el-menu {
  overflow: hidden !important;
  border-right: none !important;
}
::v-deep {
  .el-menu--collapse .el-submenu__title span {
    display: none !important;
  }
  .el-menu--collapse .el-submenu__title .el-submenu__icon-arrow {
    display: none !important;
  }
}
</style>
